// import Vue from 'vue'
import Router from 'vue-router'
import Recharge from '../router/security/recharge.vue';
import sreg from './activity/sreg.vue';
import lottery from '../router/lottery/lottery.vue';
import lotteryhb from '../router/lottery/lotteryhb.vue';
import Jclq from '../router/huodongland/jclq.vue';
import Fkzm from '../router/huodongland/fkzm.vue';
import China from '../router/huodongland/china.vue';
import God2 from '../router/huodongland/god2.vue';
import activezhui from '../router/chasecombo/index.vue'
import Huodongland from '../router/huodongland/index.vue';
import Freessq from '../router/huodongland/getfreessq.vue';
import eleven from '../router/doubleelevenredpacket/index.vue';
import ssq from '../router/huodongland/ssq.vue';
import elevenhome from '../router/doubleelevenredpacket/home.vue';
import elevenshare from '../router/doubleelevenredpacket/share.vue';
import godnew from '../router/huodongland/godnew.vue';
import lotteryballs from '../router/lotteryballs/lottery.vue';
import lotteryballshb from '../router/lotteryballs/lotteryhb.vue';
import invite from '../router/huodongland/invite.vue';
import chuanact from '../router/huodongland/chuanact.vue';
import danperten from '../router/huodongland/danperten.vue';
import lotteryshare from '../router/huodongland/lotteryshare.vue';
import newren from '../router/huodongland/newren.vue';
import sharedan from '../router/sharedan/index.vue';
import dandetails from '../router/sharedan/dandetails.vue';
import payresult from '../router/activity/payresult.vue';
import guessindex from '../router/guessing/index.vue';
import guesshistry from '../router/guessing/history.vue';
import myguess from '../router/guessing/myguess.vue';
import guessDetails from '../router/guessing/guess_details.vue';
import focusCompetition from '../router/focusCompetition/index.vue';
Vue.use(Router);

const router = new Router({
    routes: [
        {
            path: '/',
            name: 'security',
            component: Recharge
        },
        {
            path:'/focusCompetition',
            name: 'focusCompetition',
            component:focusCompetition
        },
        {
            path: '/sreg',
            name: 'sreg',
            component: sreg,
        },
        {
            path: '/lottery',
            name: 'lottery',
            component: lottery,
        },
        {
            path: '/lotteryhb',
            name: 'lotteryhb',
            component: lotteryhb,
        },
        {
            path: '/lotteryballs',
            name: 'lotteryballs',
            component: lotteryballs,
            meta: {
                title: '高频抽奖'
            },
        },
        {
            path: '/lotteryballshb',
            name: 'lotteryballshb',
            component: lotteryballshb,
            meta: {
                title: '我的红包'
            },
        },
        {
            path: '/activezhui',
            name: 'activezhui',
            component: activezhui,
            meta: {
                title: '追号套餐'
            },
        },
        {
            path: '/payresult/:appcode',
            name: 'payresult',
            component: payresult,
            meta: {
                title: '支付结果'
            },
        },
        {
            path: '/eleven',
            name: 'eleven',
            component: elevenhome,
            redirect: '/eleven/index',
            children: [
                {
                    path: 'index',
                    name: 'index',
                    component: eleven,
                    meta: {
                        title: '双11抢红包'
                    },
                },
                {
                    path: 'share',
                    name: 'share',
                    component: elevenshare,
                    meta: {
                        title: '双11抢红包'
                    },
                },
            ]
        },
        {
            path: '/huodongland',
            name: 'huodongland',
            component: Huodongland,
            children: [
                {
                    path: 'lotteryshare',
                    name: 'lotteryshare',
                    component: lotteryshare,
                    meta: {
                        title: '沾喜气送1000万'
                    },
                },
                {
                    path: 'sharedan',
                    name: 'sharedan',
                    component: sharedan,
                    meta: {
                        title: '晒单列表'
                    },
                },
                {
                    path: 'dandetails/:id',
                    name: 'dandetails',
                    component: dandetails,
                    meta: {
                        title: '晒单详情'
                    },
                },
                {
                    path: 'chuanact/:itemid',
                    name: 'chuanact',
                    component: chuanact,
                    meta: {
                        title: '串关加奖10%'
                    },
                },
                {
                    path: 'newren',
                    name: 'newren',
                    component: newren,
                    meta: {
                        title: '新人送彩票'
                    },
                },
                {
                    path: 'danperten/:itemid',
                    name: 'danperten',
                    component: danperten,
                    meta: {
                        title: '单关加奖10%'
                    },
                },
                {
                    path: 'jclq',
                    name: 'jclq',
                    component: Jclq
                },
                {
                    path: 'invite',
                    name: 'invite',
                    component: invite,
                    meta: {
                        title: '彩民彩票'
                    },
                },
                {
                    path: 'godnew',
                    name: 'godnew',
                    component: godnew,
                    meta: {
                        title: '跟单不中返红包'
                    },
                },
                {
                    path: 'god2',
                    name: 'god2',
                    component: God2,
                    meta: {
                        title: '跟单不中返红包'
                    },
                },
                {
                    path: 'fkzm',
                    name: 'fkzm',
                    component: Fkzm
                },
                {
                    path: 'china',
                    name: 'china',
                    component: China,
                    meta: {
                        title: '竞足加奖10%'
                    },
                },
                {
                    path: 'getfreessq',
                    name: 'getfreessq',
                    meta: {
                        title: '免费领取一注双色球'
                    },
                    component: Freessq
                },
                {
                    path: 'ssq',
                    name: 'ssq',
                    meta: {
                        title: '双色球9亿大派奖'
                    },
                    component: ssq
                },
                {
                    path: 'guess',
                    name: 'guess',
                    meta: {
                        title: '猜比分 赢大奖'
                    },
                    component: guessindex
                },
                {
                    path: 'guesshistry',
                    name: 'guesshistry',
                    meta: {
                        title: '往期竞猜'
                    },
                    component: guesshistry
                },
                {
                    path: 'myguess',
                    name: 'myguess',
                    meta: {
                        title: '我的竞猜'
                    },
                    component: myguess
                },
                {
                    path: 'guessdetails/:id',
                    name: 'guessdetails',
                    meta: {
                        title: '竞猜详情'
                    },
                    component: guessDetails

                }
            ]
        }
    ]
});
let setDocumentTitle = function (title) {
    document.title = title;
    let ua = navigator.userAgent;
    if(/\bMicroMessenger\/([\d.]+)/.test(ua) && /ip(hone|od|ad)/i.test(ua)) {
        var i = document.createElement('iframe');
        i.src = '/favicon.ico';
        i.style.display = 'none';
        i.onload = function () {
            setTimeout(function () {
                i.remove()
            }, 9)
        };
        document.body.appendChild(i)
    }
};
router.afterEach(routes => {
    typeof routes.meta.title !== undefined && setDocumentTitle(routes.meta.title)
});


export default router;
